package com.rykj.energy.common.enums;

public enum DeviceTypes {
    //设备品牌
    hk("海康","hk"),
    dh("大华","dh"),
    ys("宇视","ys"),
    tiandy("天地伟业","tiandy"),
    //摄像头类型
    blo("枪机","blo"),
    ptz("球机","ptz"),
    half_ptz("半球","half_ptz"),
    Fisheye("鱼眼","Fisheye"),
    other("其他","other"),
    //设备类型
    camera("摄像头","camera"),
    NVR("NVR","NVR"),
    RTSP("RTSP","RTSP"),
    capture("人脸抓拍机","capture"),
    wisdomBox("智能盒子","wisdomBox"),
    boxCamera("智能盒子摄像头","boxCamera"),
    wisdom("智能摄像头","wisdom"),
    wisdomAIO("智能一体机","wisdomAIO"),
    AIOCamera("智能一体机摄像头","AIOCamera"),
    streamDevice("流媒体设备","streamDevice"),
    streamChannel("流媒体通道","streamChannel");


    private String name;
    private String code;

    DeviceTypes(String name, String code){
        this.name = name;
        this.code = code;
    }
    public static String getCodeByName(String name){
        if(null==parseByName(name)){
          return "";
        }
        return parseByName(name).getCode();
    }

    public static String getNameByCode(String code){
        if(null==parseByCode(code)){
            return "";
        }
        return parseByCode(code).getName();
    }

    public static DeviceTypes parseByName(String name){
        for(DeviceTypes type : values()){
            if(type.getName().equals(name)){
                return type;
            }
        }
        return null;
    }

    public static DeviceTypes parseByCode(String code){
        for(DeviceTypes type : values()){
            if(type.getCode().equals(code)){
                return type;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    }
